package cobots.swarm.colormap;

import java.awt.Color;

public class ColorMapFactory {

	private ColorMapFactory() {}

	public static ColorMap getColorMapByName(String name) {
 if ("hot".equalsIgnoreCase(name))
			return createHotColorMap();
		
		return createJetColorMap();
	}

	private static ColorMap hot = null;
	public static ColorMap createHotColorMap() {
		if (hot == null)
			hot = new InterpolationColorMap("Hot",
					new double[] {0.0, 0.3333333, 0.66666666, 1.0},
					new Color[] {Color.BLACK, Color.RED, Color.YELLOW, Color.WHITE}
			);
		return hot;
	}


	private static ColorMap jet = null;
	public static ColorMap createJetColorMap() {
		if (jet == null)
			jet = new InterpolationColorMap("Jet",
					new double[] {0.0, 0.25, 0.5, 0.75, 1.0},
					new Color[] {Color.blue ,Color.cyan, Color.yellow, Color.red, new Color(128,0,0)} 
			);
		return jet;
	}
		
}

